package draftMate.player;

import draftMate.Stat;

public class Hitter {
    public static final int NUM_FIELDS = 7;
    public static final int ROW_SIZE = 9;
    public static final int NAME = 0;
    public static final int AVG = 1;
    public static final int R = 2;
    public static final int RBI = 3;
    public static final int HR  = 4;
    public static final int SB = 5;
    public static final int POS = 6;    
    private static final int AB = 7;
    private static final int H = 8;

    

    private Object [] row;
    
    public Hitter(String name, double ab, double h, double hr, double r,
            double rbi, double sb, String pos) {
        super();
        row = new Object[ROW_SIZE];
        row[NAME] = name;
        row[AB] = ab;
        row[H] = h;
        row[HR] = hr;
        row[R] = r;
        row[RBI] = rbi;
        row[SB] = sb;
        row[AVG] = h / ab;
        row[POS] = pos;
    }
    public String getName() {
        return (String)row[NAME];
    }
    public String getPos() {
        return (String)row[POS];
    }
    public void setPos(String pos) {
        row[POS] = pos;
    }
    public double getAb() {
        return (double)row[AB];
    }
    public double getHits() {
        return (double)row[H];
    }
    public double getHr() {
        return (double)row[HR];
    }
    public double getRuns() {
        return (double)row[R];
    }
    public double getRbi() {
        return (double)row[RBI];
    }
    public double getSteals() {
        return (double)row[SB];
    }  
    public Object getValAt(int c) {
        return row[c];
    }
    
    public String toString() {
        String string = "";
        
        for (int i = 0; i < ROW_SIZE; i++) {
            if (i != AVG) {
                string += row[i] + ",";
            } // leave out avg since we don't use it in constructor
        }
        return string;
    }
}
